﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;

namespace EasyStep.Business
{
    public static class ObjectMapper
    {
        public static void CreateMap<TSource, TDestination>()
        {
            Mapper.CreateMap<TSource, TDestination>();
        }

        public static void CreateMap<TSource, TDestination>(IEnumerable<string> ignoreProperies)
        {
            IMappingExpression<TSource, TDestination> expression = Mapper.CreateMap<TSource, TDestination>();
            ignoreProperies.ToList().ForEach(property => 
            {
                expression.ForMember(property, options => options.Ignore());
            });
        }

        public static TDestination ResolveMap<TSource, TDestination>(TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }

        public static void Configure()
        {
            Mapper.AssertConfigurationIsValid();
        }
    }
}